-
Notifications
You must be signed in to change notification settings - Fork 25
issue #34 and #35 - adding new command to pull a #140
issue #34 and #35 - adding new command to pull a #140
Conversation
Issues #134 and #135The question came up... is there an easy way to copy a file from a URL and copy it into a project? There are a few possibilities in the VS Code Extension Marketplace, but nothing that worked quite how we needed it to. As a result, we decided to roll our own. So let's say we have this image: We can find it at this URL: https://media.giphy.com/media/7DzlajZNY5D0I/giphy.gif We've now created a new command that will take that URL and some additional optional parameters to do some cool things... Copying a File into the Workspace root with no name changeLet's say we want to copy it into our project. I've created a new command that takes the URL, the file name, and an optional path for the workspace.
Here's the Didact URL: Copying a File and Changing the Name
Here's the Didact URL: What if we want to change the name and put it into a specific folder?This time we'll try a different Spongebob... we're getting excited!
Here's the Didact URL: That's all well and good, but what if I have an archive file I want to pull down and unzip at the same time?This is another issue (#135) that came up and now we can do that too! Let's take the Apache Camel K examples archive and unzip it into a new folder called
Here's the Didact URL: Next StepsWe still have some testing to do and some validation steps to add around file overwriting and the like, but we're making some progress! |
Still need to see about testing (though not exactly sure how) and adding more validation around overwriting files, but I think this is a good start. I re-used code from the Camel K extension to handle the download and extract cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- what about adding the good examples that you put in comment of the PR directly as an example in the codebase? I think that it will really useful.
- In example, the last parameter to extract or not is passed as a simple boolean. What do you think having to specify a parameter name such as "extract=true"? having just the
$$true
I was wondering what the true is for. It would also allows to add more parameters in the future without collision. - for testing, a first step would be to call the command through the didact entry point using the Didact url. (command.handler.processInputs ?)
Yes, I can add a new examples markdown that re-uses the examples I documented here.
Though I see what you're after there, that's definitely a much larger change than this PR. Can we spin that off into another JIRA to possibly handle in the future?
Hmmm. Not sure I understand quite what you're suggesting here? |
Why is it more complicated than the other parameters? such as |
in #140 (comment) you said so I'm suggesting a way to test the functionality which is added in this PR. it doesn't sound a big chunk of work. providing the test when writing the feature is usually better. |
No, I get that we need tests. I'm more asking about your suggestion to call the command through the didact entry point using the Didact url. (command.handler.processInputs? ) What are you proposing as far as the test? (That's what I was getting at, sorry I wasn't clearer.) |
I am pondering getting rid of the That said, I think adding an option for name/value pairs to be specified as part of the Didact url is an interesting one. At this point it's only special cases that use that approach and the rest of the parameters are by order. If you create a JIRA we can discuss this further in that context and I can point to examples more easily. :) |
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
95387d9
to
a0b1510
Compare
Only question remaining is how much validation to add... Do we check to see if the file is there? If so, do we prompt the user before we overwrite it or reject it because it already exists? |
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: bfitzpat@redhat.com <bfitzpat@redhat.com>
file from a URL, rename it, put it into a folder, and even unzip it
Signed-off-by: bfitzpat@redhat.com bfitzpat@redhat.com